<template>
    <div>
        <div class="need_check_msg">
            <el-row :gutter="12">
                <el-col :span="12">
                    <el-card class="box-card" shadow="never">
                        {{ userInfo.username }}，欢迎使用
                    </el-card>
                </el-col>
            </el-row>
            <el-card class="box-card" shadow="always">
                <div slot="header" class="clearfix">
                    <span>待签单项目</span>
                </div>
                <project :operation-list="operationList" :is-show="true" :model-status="3"></project>
            </el-card>
        </div>
    </div>
</template>

<script>
import project from "@/views/project/includes/Project";

export default {
    name: "NeedCheckMsg",
    components: {
        project,
    },
    data() {
        return {
            userInfo: JSON.parse(localStorage.getItem('mujinguserInfo')),
            operationList: [],
        };
    },
    created() {
        this.getOperationList();
    },
    methods: {
        getOperationList() {
            this.$store.state.permissionList.forEach(item => {
                const [itemName] = item.permission.split(":");
                if (itemName === "project") {
                    this.operationList = item.list.map(listItem => {
                        return listItem.permission.split(":")[1];
                    });
                }
            });
            this.$store.state.permissionList.forEach(item => {
                const [itemName] = item.permission.split(":");
                if (itemName === "order") {
                    this.operationList.push("order:view");
                    item.list.some(listItem => {
                        const listItemType = listItem.permission.split(":")[1];
                        if (listItemType === "add") {
                            this.operationList.push("order:add");
                            return true;
                        }
                        return false;
                    });
                }
            });
        },
    },
};
</script>

<style scoped>
.need_check_msg{
    /* max-height: 500px; */
    /* overflow-y: auto; */
}
</style>
